#ifndef GLOBALTHRESHOLDBINARISATION_HPP
#define GLOBALTHRESHOLDBINARISATION_HPP

#include <girlTools/girlToolsImage.hpp>
#include <girl/girlToger.hpp>
#include "ThresholdSameRegion.hpp"



class GlobalThresholdBinarisation
{
public:
    GlobalThresholdBinarisation(const girl::tools::Image &image, int threshold);

    ~GlobalThresholdBinarisation();

    girl::regionDeque * regions()
    {return &_regions;}

    girl::regionDeque * underThdRegions()
    {
        return &_underThdRegions;
    }

    girl::toger  * toger()
    {return &_toger;}


    /**
      *
      * Work in progress DO NOT USE
      */
/*    class UnderThresholdIterator
    {
        UnderThresholdIterator(girl::regionDeque &regions,girl::toger &tog, int threshold,
                               const girl::tools::Image &image)
            :_regions(region),_tog(tog), _threshold(threshold),_image(image){}

        girl::regionDeque::iterator begin()
        {
            currentIt = _regions.begin();
            girl::regionDeque::iterator itEnd = _regions.end();
            do
            {
                girl::point p = _tog.anyPoint(*currentIt);
            }while(_image.getPixel(p.x(),p.y()).a() > _threshold);
            return currentIt;
        }

        bool isDone()
        {
            return false;
        }


    protected :
            girl::regionDeque &_regions;
            girl::regionDeque::iterator currentIt;
            girl::toger &_tog;
            int _threshold;
            const girl::tools::Image &_image;
    };
*/

protected :
    const girl::tools::Image &_image;
    int _threshold;
    girl::regionDeque _regions;
    girl::regionDeque _underThdRegions;
    girl::toger _toger;
    girl::toger::sameRegion *sameRegion;
};

#endif // GLOBALTHRESHOLDBINARISATION_HPP
